using System.Collections;
using System.Collections.Generic;
using QAssetBundle;
using QFramework;
using UnityEngine;

namespace QFramework.Example
{

    public class ExpUpgradeSystem : AbstractSystem
    {
        public List<ExpUpgradeItem> list_ExpUpgradeItems = new List<ExpUpgradeItem>(); 

        private ExpUpgradeItem Add(ExpUpgradeItem exp){
            list_ExpUpgradeItems.Add(exp);
            return exp;
        }

        protected override void OnInit()
        {
            var expDropUpgradeLv1 = Add(new ExpUpgradeItem()
            .OnKey("add_ExpDropLv1"))
            .OnDescription("升级Sample Ability攻击力 Lv1")
            .OnUpgrade((_)=>{
                Time.timeScale = 1;
                AudioKit.PlaySound(Sfx.ABILITYLEVELUP);
                Global.SimpleAbilityAtk.Value++;
            });

            var expDropUpgradeLv2 = Add(new ExpUpgradeItem()
            .OnKey("add_ExpDropLv2"))
            .OnDescription("升级Sample Ability攻击力 Lv2")
            .OnCondition((_)=>expDropUpgradeLv1.UpgradeFinish)
            .OnUpgrade((_)=>{
                Time.timeScale = 1;
                AudioKit.PlaySound(Sfx.ABILITYLEVELUP);
                Global.SimpleAbilityAtk.Value++;
            });

            var expDropUpgradeLv3 = Add(new ExpUpgradeItem()
            .OnKey("add_ExpDropLv3"))
            .OnDescription("升级Sample Ability攻击力 Lv3")
            .OnCondition((_)=>expDropUpgradeLv2.UpgradeFinish)
            .OnUpgrade((_)=>{
                Time.timeScale = 1;
                AudioKit.PlaySound(Sfx.ABILITYLEVELUP);
                Global.SimpleAbilityAtk.Value++;
            });

            var expDropUpgradeLv4 = Add(new ExpUpgradeItem()
            .OnKey("add_ExpDropLv4"))
            .OnDescription("升级Sample Ability攻击力 Lv4")
            .OnCondition((_)=>expDropUpgradeLv3.UpgradeFinish)
            .OnUpgrade((_)=>{
                Time.timeScale = 1;
                AudioKit.PlaySound(Sfx.ABILITYLEVELUP);
                Global.SimpleAbilityAtk.Value++;
            });

            var expDropUpgradeLv5 = Add(new ExpUpgradeItem()
            .OnKey("add_ExpDropLv5"))
            .OnDescription("升级Sample Ability攻击力 Lv5")
            .OnCondition((_)=>expDropUpgradeLv4.UpgradeFinish)
            .OnUpgrade((_)=>{
                Time.timeScale = 1;
                AudioKit.PlaySound(Sfx.ABILITYLEVELUP);
                Global.SimpleAbilityAtk.Value++;
            });
        }

    }
}
